package com.api.shopapi.mapper;

import com.api.shopapi.entity.MedicationSchedulingNoon;
import com.api.shopapi.entity.dto.MedicationSchedulingNoonDTO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface MedicationSchedulingNoonMapper {

    @Insert("insert into  medication_scheduling_noon " +
            "(MedicationSchedulingNoonCode,MedicationSchedulingCode) " +
            "values (#{medicationSchedulingNoon.MedicationSchedulingNoonCode} ,#{medicationSchedulingNoon.medicationSchedulingCode} )")
    int insert(@Param("medicationSchedulingNoon") MedicationSchedulingNoon medicationSchedulingNoon);

    @Update("update medication_scheduling_noon set MedicationSchedulingCode=#{medicationSchedulingNoon.MedicationSchedulingCode} where MedicationSchedulingNoonCode=#{medicationSchedulingNoon.MedicationSchedulingNoonCode}   ")
    int updateByMedicationSchedulingNoonCode(@Param("medicationSchedulingNoon") MedicationSchedulingNoon medicationSchedulingNoon);

    @Delete("delete from medication_scheduling_noon where MedicationSchedulingNoonCode=#{medicationSchedulingNoonCode} ")
    int deleteByMedicationSchedulingNoonCode(@Param("medicationSchedulingNoonCode")String medicationSchedulingNoonCode);

    @Select("select * from medication_scheduling_noon where MedicationSchedulingNoonCode=#{medicationSchedulingNoonCode} limit 1")
    MedicationSchedulingNoon getByMedicationSchedulingNoonCode(@Param("medicationSchedulingNoonCode")String medicationSchedulingNoonCode);

    @Select("select * from medication_scheduling_noon where medicationSchedulingCode=#{medicationSchedulingCode} limit 1")
    MedicationSchedulingNoonDTO getByMedicationSchedulingCode(@Param("medicationSchedulingCode") String medicationSchedulingCode);
}
